//
//  WCProjectSplitView.m
//  WabbitCode
//
//  Created by William Towe on 1/31/09.
//  Copyright 2009 Revolution Software. All rights reserved.
//

#import "WCProjectSplitView.h"


@implementation WCProjectSplitView
- (void)drawDividerInRect:(NSRect)rect {
	//[[NSColor controlBackgroundColor] setFill];
	//NSRectFill(rect);
	static NSGradient *gradient = nil;
	static NSColor *borderColor = nil;
	if (!gradient) {
		gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:(253.0f / 255.0f) alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:(222.0f / 255.0f) alpha:1.0]];
		//gradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:190.0/255.0 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:190.0/255.0 alpha:1.0]];
		borderColor = [[NSColor colorWithCalibratedWhite:(165.0f / 255.0f) alpha:1.0] retain];
	}

	[gradient drawInRect:rect angle:([self isVertical])?180.0:90.0];
	
	[borderColor setFill];
	if ([self isVertical]) {
		NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, 1.0, rect.size.height));
		NSRectFill(NSMakeRect(rect.origin.x+rect.size.width-1, rect.origin.y, 1.0, rect.size.height));
	}
	else {
		NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, rect.size.width, 1.0));
		NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y+rect.size.height, rect.size.width, 1.0));
	}
	
	[super drawDividerInRect:rect];
} 
@end
